package com.quasar.hpatient.glide;

import android.os.Environment;

import com.bumptech.glide.load.engine.cache.DiskLruCacheFactory;

import java.io.File;

/**
 * description: Glide外部缓存路径
 * created by kalu on 2016/10/24 15:27
 */
final class GlideDiskCache extends DiskLruCacheFactory {

    public GlideDiskCache(final String folderName, long diskCacheSize) {
        super(new CacheDirectoryGetter() {
            @Override
            public File getCacheDirectory() {
                File cacheDirectory = new File(Environment.getExternalStorageDirectory().getPath() + "//" + folderName);
                // LogUtil.e("GlideDiskCache", cacheDirectory.getAbsolutePath());
                if (!cacheDirectory.exists()) {
                    //     LogUtil.e("GlideDiskCache", cacheDirectory.getAbsolutePath() + "jjjjj");
                    cacheDirectory.mkdirs();
                }
                return cacheDirectory;
            }
        }, diskCacheSize);
    }
}
